//
//  NSMutableArray+part.m
//  左滑Demo
//
//  Created by 肖棟棟 on 16/8/22.
//  Copyright © 2016年 肖棟棟. All rights reserved.
//

#import "NSMutableArray+part.h"

@implementation NSMutableArray (part)


//根据下标获取从下标开始到某一处的数组，相当于数组的截取
+(NSArray *)getPartOfArray:(NSArray *)array index:(NSInteger)index length :(NSInteger)length{
    
    NSMutableArray * mArray =[NSMutableArray array];
    //便利数组
    [array enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        
        if (idx == length + index) {
            *stop = YES;
        }

        if (idx >= index) {
            [mArray addObject:obj];
        }
        
        
        
    }];

    return mArray;
    
}

@end
